import { exportUrl, downloadTemplateUrl } from "@/api/scanStart/mesScanStart"

import { exportExcel } from "@/utils/judge"

// 列表头按钮配置
export const operateList = [
  {
    name: $i18n.t("common.export"),
    type: "primary",
    icon: "el-icon-download",
    handleName: "export", //点击时返回的标识
    url: exportUrl
    //auth: "auth:operlog:export", //权限字段
  }
  // {
  //   name: "新增",
  //   type: "primary",
  //   icon: "el-icon-circle-plus-outline",
  //   handleName: "add", //点击时返回的标识
  // },
  // {
  //   name: "删除",
  //   type: "danger",
  //   icon: "el-icon-delete",
  //   handleName: "deleteBatch", //点击时返回的标识
  //   isMultiple: true, // isSingle 表示必须选择一项//isMultiple: true, // 表示必须多选
  // },
  // {
  //   name: "导入",
  //   type: "primary",
  //   icon: "el-icon-circle-plus-outline",
  //   handleName: "import", //点击时返回的标识
  // },
]
// 行末按钮配置
export const rowConfig = [
  {
    name: $i18n.t("common.details"),
    type: "info",
    class: "row-btn-info",
    handleName: "detail" //点击时返回的标识
  }
  // {
  //   name: "删除",
  //   type: "danger",
  //   class: "row-btn-danger",
  //   handleName: "delete", //点击时返回的标识
  // },
]
// 搜索条件配置
export const searchConfig = {
  inline: true,
  formDesc: {
    barcode: {
      type: "input",
      label: $i18n.t("mesScanStart.barcode")
    },
    lineName: {
      type: "input",
      label: $i18n.t("mesScanStart.prodLineName")
    },
    productProcessName: {
      type: "input",
      label: $i18n.t("mesScanStart.prodProcessName")
    },
    userName: {
      type: "input",
      label: $i18n.t("mesScanStart.userName")
    },
    scanTime: {
      type: "datetimerange",

      label: $i18n.t("mesScanStart.scanTime"),
      attrs: {
        valueFormat: "yyyy-MM-dd HH:mm:ss",
        searchArrKey: ["scanTimeMin", "scanTimeMax"]
      }
    },
    equipmentName: {
      type: "input",
      label: $i18n.t("mesScanStart.equipmentName")
    },
    frockName: {
      type: "input",
      label: $i18n.t("mesScanStart.frockName")
    },
    orderCode: {
      type: "input",
      label: $i18n.t("mesScanStart.productWorkOrder")
    },
    prodName: {
      type: "input",
      label: $i18n.t("mesScanStart.prodName")
    },
    workshopCode: {
      type: "input",
      label: $i18n.t("mesScanStart.workshopCode")
    },
    workshopName: {
      type: "input",
      label: $i18n.t("mesScanStart.workshopName")
    }
  }
}
// 新增/删除表单配置
export const formDescDialog = {
  span: 24,
  disabled: false,
  isShowSubmitBtn: true,
  formDesc: {
    barcode: {
      type: "input",
      label: $i18n.t("mesScanStart.barcode"),
      layout: 24,
      required: false
    },
    lineCode: {
      type: "input",
      label: $i18n.t("mesScanStart.prodLineCode"),
      layout: 12,
      required: false
    },
    lineName: {
      type: "input",
      label: $i18n.t("mesScanStart.prodLineName"),
      layout: 12,
      required: false
    },
    productProcessCode: {
      type: "input",
      label: $i18n.t("mesScanStart.prodProcessCode"),
      layout: 12,
      required: false
    },
    productProcessName: {
      type: "input",
      label: $i18n.t("mesScanStart.prodProcessName"),
      layout: 12,
      required: false
    },
    workCellCode: {
      type: "input",
      label: $i18n.t("mesScanStart.workCellCode"),
      layout: 12,
      required: false
    },
    workCellName: {
      type: "input",
      label: $i18n.t("mesScanStart.workCellName"),
      layout: 12,
      required: false
    },
    workTeamCode: {
      type: "input",
      label: $i18n.t("mesScanStart.workTeamCode"),
      layout: 12,
      required: false
    },
    workTeamName: {
      type: "input",
      label: $i18n.t("mesScanStart.workTeamName"),
      layout: 12,
      required: false
    },
    workShiftCode: {
      type: "input",
      label: $i18n.t("mesScanStart.workShiftCode"),
      layout: 12,
      required: false
    },
    workShiftName: {
      type: "input",
      label: $i18n.t("mesScanStart.workShiftName"),
      layout: 12,
      required: false
    },
    userCode: {
      type: "input",
      label: $i18n.t("mesScanStart.scanCode"),
      layout: 12,
      required: false
    },
    userName: {
      type: "input",
      label: $i18n.t("mesScanStart.scanName"),
      layout: 12,
      required: false
    },
    scanTime: {
      type: "datetime",
      label: $i18n.t("mesScanStart.scanTime"),
      layout: 12,
      required: false,
      attrs: {
        valueFormat: "yyyy-MM-dd HH:mm:ss"
      }
    },
    equipmentCode: {
      type: "input",
      label: $i18n.t("mesScanStart.equipmentCode"),
      layout: 12,
      required: false
    },
    equipmentName: {
      type: "input",
      label: $i18n.t("mesScanStart.equipmentName"),
      layout: 12,
      required: false
    },
    frockCode: {
      type: "input",
      label: $i18n.t("mesScanStart.frockCode"),
      layout: 12,
      required: false
    },
    frockName: {
      type: "input",
      label: $i18n.t("mesScanStart.frockName"),
      layout: 12,
      required: false
    },
    orderCode: {
      type: "input",
      label: $i18n.t("mesScanStart.productWorkOrder"),
      layout: 12,
      required: false
    },
    workOrderCode: {
      type: "input",
      label: $i18n.t("mesScanStart.workOrderCode"),
      layout: 12,
      required: false
    },
    workOrderNode: {
      type: "input",
      label: $i18n.t("mesScanStart.workOrderName"),
      layout: 12,
      required: false
    },
    prodCode: {
      type: "input",
      label: $i18n.t("mesScanStart.prodCode"),
      layout: 12,
      required: false
    },
    prodName: {
      type: "input",
      label: $i18n.t("mesScanStart.prodName"),
      layout: 12,
      required: false
    },
    seriesCode: {
      type: "input",
      label: $i18n.t("mesScanStart.seriesCode"),
      layout: 12,
      required: false
    },
    seriesName: {
      type: "input",
      label: $i18n.t("mesScanStart.seriesName"),
      layout: 12,
      required: false
    },
    // prodOrderType: {
    //   type: "input",
    //   label: "生产订单类型：内销，外销，样机",
    //   layout: 12,
    //   required: false,
    // },
    // recordType: {
    //   type: "input",
    //   label: "类型（上线、过站、检验、下线）",
    //   layout: 12,
    //   required: false,
    // },
    // factoryCode: {
    //   type: "input",
    //   label: "工厂编码",
    //   layout: 12,
    //   required: false,
    // },
    Remark: {
      type: "input",
      label: $i18n.t("common.remark"),
      layout: 12,
      required: false
    },
    workDate: {
      type: "date",
      label: $i18n.t("mesScanStart.workday"),
      layout: 12,
      required: false,
      attrs: {
        valueFormat: "yyyy-MM-dd"
      }
    },
    count: {
      type: "number",
      label: $i18n.t("mesScanStart.countWeight"),
      layout: 12,
      required: false
    },
    machineHours: {
      type: "number",
      label: $i18n.t("mesScanStart.machineHours"),
      layout: 12,
      required: false
    },
    laborHours: {
      type: "number",
      label: $i18n.t("mesScanStart.laborHours"),
      layout: 12,
      required: false
    },
    otherHours: {
      type: "number",
      label: $i18n.t("mesScanStart.otherHours"),
      layout: 12,
      required: false
    }
    // scanType: {
    //   type: "input",
    //   label: "扫描类型0-批次；1-条码",
    //   layout: 12,
    //   required: false,
    // },
  }
}
//导入数据
export const importFormDescDialog = {
  span: 24,
  disabled: false,
  isShowSubmitBtn: true,
  formDesc: {
    model: {
      type: "button",
      label:"",// $i18n.t("mesScanStart.model"),
      layout: 24,
      required: false,
      title: $i18n.t('common.downloadTemplate'),
      style: {
        color: "#1867c0",
        fontSize: "14px"
      },
      on: {
        click: () => {
          exportExcel(downloadTemplateUrl)
        }
      }
    },
    file: {
      type: "input",
      label: $i18n.t("mesScanStart.file"),
      layout: 24
      // required: true,
    }
  }
}
